/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.sysvent.view;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import py.com.sysvent.bean.Cliente;

/**
 *
 * @author Enrique
 */
public class ClienteEditView extends javax.swing.JDialog {

    /**
     * Creates new form ClienteEditView
     */
    public ClienteEditView(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        Nombre_Texto = new javax.swing.JTextField();
        Profesion_Texto = new javax.swing.JTextField();
        Empresa_Texto = new javax.swing.JTextField();
        TeleEmpresa_Texto = new javax.swing.JTextField();
        Renta_Texto = new javax.swing.JTextField();
        Tipo_Texto = new javax.swing.JTextField();
        Ruc_Texto = new javax.swing.JTextField();
        Referencia_Texto = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        TeleRef_Texto = new javax.swing.JTextField();
        Email_Texto = new javax.swing.JTextField();
        Confirmar_Boton = new javax.swing.JButton();
        Cancelar_Boton = new javax.swing.JButton();
        Desde_Texto = new javax.swing.JFormattedTextField();
        FechaNac_Texto1 = new javax.swing.JFormattedTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Datos del cliente");
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setText("Nombre");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 14, -1, -1));

        jLabel2.setText("Fecha de Nac");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 42, -1, -1));

        jLabel3.setText("Profesion");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, -1, -1));

        jLabel4.setText("Empresa");
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 104, -1, -1));

        jLabel5.setText("Telefono Empresa");
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 135, -1, -1));

        jLabel6.setText("Renta");
        getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 163, -1, -1));

        jLabel7.setText("Tipo");
        getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 10, -1, -1));

        jLabel8.setText("Referencia");
        getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 100, -1, -1));

        jLabel9.setText("Telefono Referencia");
        getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 130, -1, -1));

        jLabel10.setText("Ruc");
        getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 40, -1, -1));

        jLabel11.setText("Desde");
        getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 70, -1, -1));

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.nomCliente}"), Nombre_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        Nombre_Texto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Nombre_TextoActionPerformed(evt);
            }
        });
        getContentPane().add(Nombre_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 200, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.profesionCliente}"), Profesion_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(Profesion_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 70, 200, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.empresaCliente}"), Empresa_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        Empresa_Texto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Empresa_TextoActionPerformed(evt);
            }
        });
        getContentPane().add(Empresa_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 100, 200, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.telEmpresa}"), TeleEmpresa_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(TeleEmpresa_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 130, 200, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.rentaCliente}"), Renta_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(Renta_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 160, 200, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.tipoCliente}"), Tipo_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        Tipo_Texto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Tipo_TextoActionPerformed(evt);
            }
        });
        getContentPane().add(Tipo_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 10, 170, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.rucCliente}"), Ruc_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(Ruc_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 40, 170, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.refCliente}"), Referencia_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(Referencia_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 100, 170, -1));

        jLabel12.setText("Email");
        getContentPane().add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 160, -1, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.telReferencia}"), TeleRef_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        getContentPane().add(TeleRef_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 130, 170, -1));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.email}"), Email_Texto, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        Email_Texto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Email_TextoActionPerformed(evt);
            }
        });
        getContentPane().add(Email_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 160, 170, -1));

        Confirmar_Boton.setText("Confirmar");
        Confirmar_Boton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Confirmar_BotonActionPerformed(evt);
            }
        });
        getContentPane().add(Confirmar_Boton, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 210, -1, -1));

        Cancelar_Boton.setText("Cancelar");
        Cancelar_Boton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Cancelar_BotonActionPerformed(evt);
            }
        });
        getContentPane().add(Cancelar_Boton, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 210, -1, -1));

        Desde_Texto.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.desdeCliente}"), Desde_Texto, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        getContentPane().add(Desde_Texto, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 70, 170, -1));

        FechaNac_Texto1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${registroActual.fchNacimiento}"), FechaNac_Texto1, org.jdesktop.beansbinding.BeanProperty.create("value"));
        bindingGroup.addBinding(binding);

        getContentPane().add(FechaNac_Texto1, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 40, 200, -1));

        bindingGroup.bind();

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void Nombre_TextoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Nombre_TextoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Nombre_TextoActionPerformed

    private void Empresa_TextoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Empresa_TextoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Empresa_TextoActionPerformed

    private void Tipo_TextoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Tipo_TextoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Tipo_TextoActionPerformed

    private void Email_TextoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Email_TextoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Email_TextoActionPerformed

    private void Confirmar_BotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Confirmar_BotonActionPerformed
       
        setConfirmarCliente(true);
        setVisible(false);
        
    }//GEN-LAST:event_Confirmar_BotonActionPerformed

    private void Cancelar_BotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Cancelar_BotonActionPerformed
        
        setConfirmarCliente(false);
        setVisible(false);
        
    }//GEN-LAST:event_Cancelar_BotonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ClienteEditView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ClienteEditView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ClienteEditView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ClienteEditView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ClienteEditView dialog = new ClienteEditView(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    
        protected Cliente registroActual;

    /**
     * Get the value of registroActual
     *
     * @return the value of registroActual
     */
    public Cliente getRegistroActual() {
        return registroActual;
    }

    /**
     * Set the value of registroActual
     *
     * @param registroActual new value of registroActual
     */
    public void setRegistroActual(Cliente registroActual) {
        Cliente oldRecord = this.registroActual;
        this.registroActual = registroActual;
        propertyChangeSupport.firePropertyChange("registroActual", oldRecord, registroActual);

    }
    private transient final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    /**
     * Add PropertyChangeListener.
     *
     * @param listener
     */
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Remove PropertyChangeListener.
     *
     * @param listener
     */
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }

        protected boolean confirmarCliente;

    /**
     * Get the value of confirmarCliente
     *
     * @return the value of confirmarCliente
     */
    public boolean isConfirmarCliente() {
        return confirmarCliente;
    }

    /**
     * Set the value of confirmarCliente
     *
     * @param confirmarCliente new value of confirmarCliente
     */
    public void setConfirmarCliente(boolean confirmarCliente) {
        this.confirmarCliente = confirmarCliente;
    }

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Cancelar_Boton;
    private javax.swing.JButton Confirmar_Boton;
    private javax.swing.JFormattedTextField Desde_Texto;
    private javax.swing.JTextField Email_Texto;
    private javax.swing.JTextField Empresa_Texto;
    private javax.swing.JFormattedTextField FechaNac_Texto1;
    private javax.swing.JTextField Nombre_Texto;
    private javax.swing.JTextField Profesion_Texto;
    private javax.swing.JTextField Referencia_Texto;
    private javax.swing.JTextField Renta_Texto;
    private javax.swing.JTextField Ruc_Texto;
    private javax.swing.JTextField TeleEmpresa_Texto;
    private javax.swing.JTextField TeleRef_Texto;
    private javax.swing.JTextField Tipo_Texto;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
